Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generating test transactions with move script #775

Open
wants to merge 1 commit into
base: 01-17-importing_test_transactions
Choose a base branch
from

Conversation

yuunlimm
Copy link
Contributor

@yuunlimm yuunlimm commented Jan 17, 2025

Description

Screenshot 2025-01-17 at 10.50.19 AM.png

Checklist

  • If any existing pages were renamed or removed:
    • Were redirects added to next.config.mjs?
    • Did you update any relative links that pointed to the renamed / removed pages?
  • Do all Lints pass?
    • Have you ran pnpm fmt?
    • Have you ran pnpm lint?

Copy link

vercel bot commented Jan 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
developer-docs-nextra ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 23, 2025 9:48pm

@yuunlimm yuunlimm mentioned this pull request Jan 17, 2025
2 tasks
Copy link
Contributor Author

yuunlimm commented Jan 17, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@yuunlimm yuunlimm force-pushed the 01-17-generating_test_transactions_with_move_script branch from f346475 to 337099f Compare January 17, 2025 18:50
@yuunlimm yuunlimm marked this pull request as ready for review January 17, 2025 18:50
@yuunlimm yuunlimm requested review from a team, gregnazario, hariria and igor-p as code owners January 17, 2025 18:50
Comment on lines 458 to 467
source:
"/indexer/indexer-sdk/documentation/advanced-tutorials/txn-scripts",
destination:
"/en/build/indexer/indexer-sdk/documentation/advanced-tutorials/txn-scripts",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The redirect paths (txn-scripts) don't match the actual file name (txn-script). This mismatch will cause the redirect to fail. The paths in the redirect configuration should be updated to use txn-script to match the MDX file name.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please ensure this matches the file name


Once the Move files and configuration are set up, run the same command used to import transactions:
- testing-folder is where your Move files are stored.
- output-foler can be set to any folder where you want to store the generated files.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix typo: output-foler should be output-folder in the command line argument description. This documentation error could cause copy/paste issues for developers following these steps.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo output-folder

@@ -0,0 +1,78 @@
---
title: "Aptos Transaction Import"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The title Aptos Transaction Import is inconsistent with the document's content, which focuses on generating test transactions with Move scripts. Consider updating the title to Generating Test Transactions with Move Scripts to accurately reflect the material covered in this guide.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This title doesn't match, since this is using a script instead of an importer

Comment on lines 458 to 467
source:
"/indexer/indexer-sdk/documentation/advanced-tutorials/txn-scripts",
destination:
"/en/build/indexer/indexer-sdk/documentation/advanced-tutorials/txn-scripts",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please ensure this matches the file name

@@ -0,0 +1,78 @@
---
title: "Aptos Transaction Import"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This title doesn't match, since this is using a script instead of an importer

Comment on lines 9 to 11
### Steps:

1. **Create Your Move Project**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a <Steps> type, which will handle this automatically. Take a look at some of the other files on ways to do it, and it'll make it easier.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh this is nice! thanks for the suggestion!


Once the Move files and configuration are set up, run the same command used to import transactions:
- testing-folder is where your Move files are stored.
- output-foler can be set to any folder where you want to store the generated files.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo output-folder

3. Output the generated JSON files to the designated folder (`~/aptos-core/ecosystem/indexer-grpc/indexer-transaction-generator/json_transactions`).
4. Update `generated_transactions.rs` with the new transaction names specified in step 3.

### How to Use the Testing Transactions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### How to Use the Testing Transactions
### How to Use Test Transactions

@yuunlimm yuunlimm force-pushed the 01-17-generating_test_transactions_with_move_script branch from 337099f to 41c221f Compare January 23, 2025 18:16
@yuunlimm yuunlimm force-pushed the 01-17-importing_test_transactions branch from d35779c to 18f5a07 Compare January 23, 2025 18:22
@yuunlimm yuunlimm force-pushed the 01-17-generating_test_transactions_with_move_script branch from 41c221f to f4a5496 Compare January 23, 2025 18:22
@yuunlimm yuunlimm force-pushed the 01-17-importing_test_transactions branch from 18f5a07 to e3a6dae Compare January 23, 2025 18:26
@yuunlimm yuunlimm force-pushed the 01-17-generating_test_transactions_with_move_script branch from f4a5496 to 7c9ef01 Compare January 23, 2025 18:26
@yuunlimm yuunlimm force-pushed the 01-17-importing_test_transactions branch from e3a6dae to 51b360e Compare January 23, 2025 18:27
@yuunlimm yuunlimm force-pushed the 01-17-generating_test_transactions_with_move_script branch from 7c9ef01 to 443f3c1 Compare January 23, 2025 18:27
@yuunlimm yuunlimm force-pushed the 01-17-importing_test_transactions branch from 51b360e to 0307421 Compare January 23, 2025 18:30
@yuunlimm yuunlimm force-pushed the 01-17-generating_test_transactions_with_move_script branch from 443f3c1 to 719d843 Compare January 23, 2025 18:30
@yuunlimm yuunlimm force-pushed the 01-17-importing_test_transactions branch from 0307421 to d1e31ef Compare January 23, 2025 18:33
@yuunlimm yuunlimm force-pushed the 01-17-generating_test_transactions_with_move_script branch from 719d843 to fc57bc1 Compare January 23, 2025 18:34
@yuunlimm yuunlimm force-pushed the 01-17-generating_test_transactions_with_move_script branch from fc57bc1 to ee03a7e Compare January 23, 2025 19:47


## Next Steps
Once the transaction constants are integrated, you can use them in processor tests to validate functionality. For detailed instructions on writing processor tests, refer to [Writing Processor Tests]().
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty link [Writing Processor Tests]() will be broken when rendered. Please either add the correct URL path to the parentheses or remove the Markdown link formatting if the destination page doesn't exist yet.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.


1. Read the configuration in the `move_fixtures` folder.
2. Execute the specified Move scripts.
3. Output the generated JSON files to the designated folder (`~/aptos-core/ecosystem/indexer-grpc/indexer-transaction-generator/json_transactions`).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output path shown in the documentation (~/aptos-core/ecosystem/indexer-grpc/indexer-transaction-generator/json_transactions) differs from the path specified in the command (../indexer-test-transactions/src/). This discrepancy should be resolved to ensure users can follow the instructions correctly. Consider updating either the command or the documentation to show the correct output path.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

@yuunlimm yuunlimm force-pushed the 01-17-importing_test_transactions branch from 5fd548e to aeacbb0 Compare January 23, 2025 21:16
@yuunlimm yuunlimm force-pushed the 01-17-generating_test_transactions_with_move_script branch from ee03a7e to 8736bb3 Compare January 23, 2025 21:17
@yuunlimm yuunlimm force-pushed the 01-17-importing_test_transactions branch from aeacbb0 to 60db79c Compare January 23, 2025 21:38
@yuunlimm yuunlimm force-pushed the 01-17-generating_test_transactions_with_move_script branch from 8736bb3 to 260f684 Compare January 23, 2025 21:38
### Set up `move_fixtures` folder
Before proceeding, ensure you have the move_fixtures folder set up in the appropriate location:
1. Location:
The move_fixtures folder should be created in the `aptos-core/ecosystem/indexer-grpc/indexer-transaction-generator/imported_transactions` directory. This is the folder where Move scripts and their configurations for test transactions will be stored.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The move_fixtures folder should be created in the `aptos-core/ecosystem/indexer-grpc/indexer-transaction-generator/imported_transactions` directory. This is the folder where Move scripts and their configurations for test transactions will be stored.
The `move_fixtures` folder should be created in the `aptos-core/ecosystem/indexer-grpc/indexer-transaction-generator/imported_transactions` directory. This is the folder where Move scripts and their configurations for test transactions will be stored.

1. Location:
The move_fixtures folder should be created in the `aptos-core/ecosystem/indexer-grpc/indexer-transaction-generator/imported_transactions` directory. This is the folder where Move scripts and their configurations for test transactions will be stored.

<Callout> **Note:** Do not create the `move_fixtures` folder in your processor repository. All Move-related files should reside in the `aptos-core` repository under the specified directory. </Callout>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't you put move_fixtures in the processor repository? what if they want to add the fixtures to version control?

### Set Up Test Accounts

1. These accounts will be used to deploy your module.
2. Set up as many accounts as you need. These accounts will be used to send the scripted transactions. Refer to the guide [here](https://aptos.dev/en/build/cli/setup-cli) to create accounts.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. Set up as many accounts as you need. These accounts will be used to send the scripted transactions. Refer to the guide [here](https://aptos.dev/en/build/cli/setup-cli) to create accounts.
2. Set up as many accounts as you need. These accounts will be used to send the scripted transactions. Refer to [Aptos CLI](https://aptos.dev/en/build/cli/setup-cli) to create accounts.


## Overview:

This section outlines how to create test transactions with Move scripts.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it'd help to have details on why you need scripted txn's, and when you would use a scripted txn instead of an imported txn

Comment on lines +90 to +92
- **Add as a Dependency**:

Include the crate containing the generated transactions as a dependency in the `Cargo.toml` file of your test crate. (Internally, transactions are stored in `aptos-core` and used in the [processor repo](https://github.com/aptos-labs/aptos-indexer-processors/blob/0c92d323b0f560b5f8601a831a36520ad9b72d68/rust/Cargo.toml#L34)).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed as per discussion on previous PR


```bash
cd ~/aptos-core/ecosystem/indexer-grpc/indexer-transaction-generator
cargo run -- --testing-folder ./imported_transactions --output-folder ../indexer-test-transactions/src/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cargo run -- --testing-folder ./imported_transactions --output-folder ../indexer-test-transactions/src/
cargo run -- --testing-folder ./imported_transactions --output-folder /path/to/processor/repo/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants